// stores/counter.js
import { defineStore } from 'pinia';

export const useMainStore = defineStore('main', {
	persist:{
		storage:{
			getItem(key) {
				
				return uni.getStorageSync(key)
			},
			setItem(key,val) {
				console.log('key------',key,val);
				return uni.setStorageSync(key,val)
			}
		}
	},
	state: () => {
		return { 
			count: 0,
			token:'',
			info:{},
		};
	},
	// 也可以这样定义
	// state: () => ({ count: 0 })
	actions: {
		increment() {
			this.count++;
		},
	},
});